test: add proptest coverage for task-registry and reward-engine (#86) - #90
Open
Cmitchelle7 wants to merge 4 commits into
Open
test: add proptest coverage for task-registry and reward-engine (#86)#90Cmitchelle7 wants to merge 4 commits into
Cmitchelle7 wants to merge 4 commits into
Conversation
Author
|
CI hasn't run on this PR yet — it's sitting on "awaiting approval" for a first-time/external contributor. Could a maintainer approve the workflow run when you get a chance? This branch has been through a merge-conflict resolution since the original push (4 commits total now) so I'd like CI's confirmation it all still compiles cleanly before this sits idle any longer. @cybermax4200 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
eco-tokenhad proptest coverage for mint/transfer/burn (#41); task-registryand reward-engine had none. This adds property-based fuzz tests for both,
following eco-token's existing pattern (
ProptestConfig::with_cases(20)).task-registry (3 properties)
proptest_create_task_validation— create_task succeeds iffreward_amount > 0 && max_completions > 0 && expires_at > now, overrandomized inputs including boundary/negative cases.
proptest_expiry_boundary— complete_task succeeds iff the probetimestamp is
<= expires_at, exercising the strict-less expirysemantics right around the boundary.
proptest_completion_count_invariant— assertscompletions <= max_completionsholds after every call in a randomized sequence, andthat status flips to
Completedexactly when the cap is hit.reward-engine (3 properties)
proptest_reward_range_enforced— approve_proof succeeds iffreward_amountis within the configured[min_reward, max_reward]and within the task's declared budget.
proptest_total_paid_accumulation—total_paid()equals the runningsum of approved rewards across a randomized sequence of approvals.
proptest_cooldown_boundary— a second approval for the same usersucceeds iff elapsed ledgers since the last reward are
>= cooldown,covering the
saturating_subboundary from both sides.Other changes
proptest = "=1.6.0"to[dev-dependencies]in bothtask-registry/Cargo.tomlandreward-engine/Cargo.toml(previouslyonly
eco-tokenhad it).Verification note
I was not able to run
cargo testmyself against a full Sorobantoolchain — I've cross-checked the function signatures, imports, and
types used here against the actual source (
create_task,complete_task,Ledgertrait usage, etc.), but this hasn't beencompiled end-to-end. Flagging that explicitly so review/CI catches
anything I couldn't. Happy to fix quickly if CI turns up an issue.
Out of scope
Closes #86